HapticEffect <Clone>$()

book_4_sparkGenerated
code_blocksInput

Description

The Clone method in the HapticEffect class is a virtual method that creates a copy of the current HapticEffect instance. This method is useful when you need to duplicate a haptic effect with the same properties and patterns, allowing for modifications without altering the original instance.

Usage

To use the Clone method, simply call it on an existing HapticEffect instance. The method returns a new HapticEffect object that is a copy of the original.

Example

// Create an instance of HapticEffect
HapticEffect originalEffect = new HapticEffect();

// Clone the original effect
HapticEffect clonedEffect = originalEffect.Clone();

// Modify the cloned effect without affecting the original
clonedEffect.AmplitudeScale = 0.5f;
clonedEffect.FrequencyScale = 1.2f;